home *** CD-ROM | disk | FTP | other *** search
-
- {$A+} { Align data }
- {$B-} { Boolean evaluation }
- {$E+} { 80x87 emulator }
- {$F-} { Force FAR calls }
- {$G+} { 80286 code }
- {$I-} { I/O checking }
- {$K-} { Smart Callbacks }
- {$N-} { 80x87 code }
- {$O-} { Overlays allowed }
- {$P-} { Open parameters }
- {$T-} { Typed pointers }
- {$V-} { String VAR checking }
- {$W-} { Windows stack frame for real mode }
- {$X+} { Extended syntax }
-
- {$IFDEF DEBUG}
- {$D+} { Debug information }
- {$L+} { Local symbols }
- {$Q+} { Overflow checking }
- {$R+} { Range checking }
- {$S+} { Stack checking }
- {$Y+} { Symbol reference information }
- {$ELSE}
- {$D-} { Debug information }
- {$L-} { Local symbols }
- {$Q-} { Overflow checking }
- {$R-} { Range checking }
- {$S-} { Stack checking }
- {$Y-} { Symbol reference information }
- {$ENDIF}
-
- {$C Moveable Demandload Discardable} { Code Segment attributes }
-
- {$M 4096,0}
-
- PROGRAM ScrStart;
-
- { SCRSTART instantly starts the Windows 3.1 built-in screen saver if the
- user moves the mouse twice within a second into the upper left corner
- of the screen. SCRSTART.EXE requires MAUSHOOK.DLL to work properly.
-
- This is the Pascal version of a C program originaly published in the
- German computer magazine c't (12/92). The C version was written by Peter
- Siering. The problem WITH the C version was that it didn't work properly
- with the Windows debug kernel (the hook function was in the main program,
- not in a DLL). Instead of trying to fix the C program I have re-written
- the whole thing with Borland Pascal 7.0 and separated the program into a
- main program + a DLL. It now works fine with the debug kernel. The EXE +
- DLL created with Pascal also use less memory than the C version!
-
- Uploaded by translator, Olaf Hess, CIS Id 100 031, 35 36.
- }
-
- USES WinProcs, WinTypes, MHookTpw;
-
- VAR
- hTask : THandle;
-
- (* ---- *)
-
- PROCEDURE WinMain;
-
- VAR
- Msg : TMsg;
-
- BEGIN
- IF (hPrevInst <> 0) THEN
- BEGIN { Get handle of first instance (notice the Ofs (hTask) !) }
- GetInstanceData (hPrevInst, Ofs (hTask), SizeOf (hTask));
- PostAppMessage (hTask, wm_Quit, 0, 0); { Close it down }
- Halt (0); { Close as well }
- END; { if }
-
- hTask := GetCurrentTask; { Retrieve task handle (save it for later }
-
- IF (NOT InstallMouseHook) THEN { Set the hook }
- BEGIN
- MessageBox (0, 'Failed to install hook', 'Screen Saver Start',
- mb_IconStop);
- Halt (0);
- END; { if }
-
- WHILE (GetMessage (Msg, 0, 0, 0)) DO
- BEGIN { Business as usual }
- TranslateMessage (Msg);
- DispatchMessage (Msg);
- END; { while }
-
- RemoveMouseHook; { Remove the hook }
- END; { WinMain }
-
- (* ---- *)
-
- BEGIN
- WinMain;
- END. { ScrStart }
-